﻿using System;
using System.Globalization;
using System.Windows.Data;
using System.Windows.Media;
using ControlLibrary.Enum;

namespace ControlLibrary.Extensions;

public class MessageTypeToColorConverter : IValueConverter
{
    // 根据消息类型返回对应的颜色
    public object Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
    {
        return value switch
        {
            MessageType.Success => Brushes.DarkSeaGreen,
            MessageType.Error => Brushes.OrangeRed‌,
            MessageType.Warning => Brushes.Orange,
            _ => Brushes.Gray
        };
    }

    // 反向转换，未实现
    public object ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
    {
        throw new NotImplementedException();
    }
}